/*
 * sys_env.h
 *
 *  Created on: 2017年9月14日
 *      Author: Administrator
 */

#ifndef _SYS_ENV2_H_
#define _SYS_ENV2_H_

#ifdef __cplusplus
extern "C"
{
#endif  /* __cplusplus */
#include <stdint.h>
#include "sys_env2_conf.h"

/*----------------------------------------------------------------------------*/
#define ENV2_MAGIC	(0x5A)

/*----------------------------------------------------------------------------*/
typedef enum {
    ENV2_ERR_OK = 0,
    ENV2_ERR_IO,
    ENV2_ERR_CRC,
    ENV2_ERR_NOMEM,
    ENV2_ERR_INVALID,
} env2_err_t;

env2_err_t env2_load(int no, uint8_t area, void *val, uint8_t *size);
env2_err_t env2_save(int no, uint8_t area, void *val, uint8_t len);
env2_err_t env2_del(int no);
env2_err_t env2_delete(int no, uint8_t area);
env2_err_t env2_dup(uint8_t **data, uint8_t *len);

/*----------------------------------------------------------------------------*/

#ifdef __cplusplus
}
#endif  /* __cplusplus */
#endif /* _SYS_ENV2_H_ */
